package top.suven.http.oauth;

import org.apache.commons.collections.list.TreeList;

import java.util.*;

public class OAuthConstants {
    public static final String RESOURCE_SERVER_NAME = "oauth-server";
    public static final String INVALID_CLIENT_ID = "客户端验证失败，如错误的client_id/client_secret。";
    public static final String INVALID_ACCESS_TOKEN = "accessToken无效或已过期。";
    public static final String INVALID_REDIRECT_URI = "缺少授权成功后的回调地址。";
    public static final String INVALID_AUTH_CODE = "错误的授权码。";
    // 验证accessToken
    public static final String CHECK_ACCESS_CODE_URL = "http://localhost:8080/zetark-oauth2-server/checkAccessToken?accessToken=";


    public static final String BEARER_TYPE = "Bearer";

    /**
     * 默认的 refresh_token 的有效时长: 30天
     */
    public final static long REFRESH_TOKEN_EXPIRED_MS = 30*24*60*60*1000;

    /**
     * 默认的 access_token 的有效时长: 1小时
     */
    public final static long ACCESS_TOKEN_EXPIRED_MS = 1*1*60*60*1000 ;

    public final static byte OAUTH_TOKEN_EXPIRED_MS = 1 ;

    public static void main(String[] args) {
        TreeMap<Long,TreeList> map = new TreeMap();
        List list = new TreeList();

        TreeMap<String,Integer> map2 = new TreeMap();

        map2.put("abc1",12);
        map2.put("abc2",13);

        map2.put("abc6",16);
        map2.put("abc7",17);
        map2.put("abc8",18);
        map2.put("abc3",14);
        map2.put("abc5",15);
        System.out.println(map2);

        SortedMap m2 = map2.headMap("abc4");
        System.out.println(m2);
       boolean m = m2.containsValue(13);
        System.out.println(m);



//        for (int i = 0; i< 1000; i++){
//            int ii =  JedisClusterCRC16.getSlot( String.valueOf(RandomUtil.nextLong()));
////            System.out.println(ii);
//            long key = 4L*2L*ii/16383l;
//            TreeList r = map.get(key) ;
//            if(r == null){
//                r = new  TreeList();
//            }
//            r.add(ii);
//            r.stream().sorted(Comparator.reverseOrder());
//
//            map.put(key, r);
////            list.add(ii);
//        }
////        System.out.println(map.toString());
//
//        for (Long i  : map.keySet()){
//            List r = map.get(i);
//            r.sort(Comparator.naturalOrder());
////            r.stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList());
//            System.out.println(i+" << key 16383 ====== value >> " + r.toString());
//        }
//        for (int i = 0; i< 1000; i++){
//            System.out.println(map.get(i)+" << key 16383 ====== value >> " + list.get(i));
//        }

    }

}
